package com.da.javatest.niuke.baodian;

import java.util.Arrays;

/**
 * @author chenlida
 * @date 2020/10/4 15:37
 * https://www.nowcoder.com/practice/17ab1e527c504df09a600e1af09d9a60?tpId=8&tags=&title=&diffculty=0&judgeStatus=0&rp=1
 *
 * 1  2  3
 * 4  5  6
 * 7  8  9
 * -------
 * 7  4  1
 * 8  5  2
 * 9  6  3
 */
public class C6Transform {
    public static void main(String[] args) {
        int d[][] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
        System.out.println(Arrays.deepToString(transformImage(d, 3)));
    }

    public static int[][] transformImage(int[][] mat, int n) {
        int[][] datas = new int[n][n];
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                datas[i][j] = mat[n - j - 1][i];
            }
        }
        return datas;
    }
}
